<?php
namespace app\index\controller;

use app\console\model\Activity;

class About extends Home
{
    public function index()
    {
    	$title = '公司简介';

        return view('index', compact('title'));
    }

    //企业文化
    public function culture()
    {
    	$title = '企业文化';

        return view('culture', compact('title'));
    }

    //员工活动
    public function activity()
    {
    	$title = '员工活动';

        $list = Activity::where('status', 1)->order('create_at desc')->select();

        return view('activity', compact('title', 'list'));
    }


    //员工活动详细
    public function at_detail($id)
    {
        $detail = Activity::find($id);
        $title = '员工活动-'.$detail['title'];

        //上一条
        $shang_info = Activity::where('id<'.$id)->order('create_at DESC')->where('status', 1)->field('id, title')->find();
        //下一条
        $xia_info = Activity::where('id>'.$id)->order('create_at DESC')->where('status', 1)->field('id, title')->find();

        return view('at_detail', compact('title', 'detail', 'shang_info', 'xia_info'));
    }

    //员工寄语
    public function employees()
    {
    	$title = '员工寄语';
        $list = \think\Db::table('jk_employees')->order('create_at desc')->limit(100)->where('status', 1)->select();

        return view('employees', compact('title', 'list'));
    }
}
